package com.yigang.homecontroller;

import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import com.alibaba.fastjson.JSON;
import com.yigang.entity.Shoppingcart;
import com.yigang.entity.ShoppingcartVO;
import com.yigang.entity.User;
import com.yigang.service.UserService;
import com.yigang.utils.UserConst;

@Controller
@RequestMapping("security")
public class SecurityController {
@Autowired
UserService userService;
@RequestMapping("/Mysecurity")
public String changepassword(Model model,String username, HttpServletRequest request, HttpSession session) {		
	Object attribute = session.getAttribute(UserConst.LOGIN_USER_INFO);
    if (null != attribute) {
        User user = JSON.parseObject((String) attribute, User.class);
        if (user != null) {
        	User clist = userService.selUserByUsername1(username);		
    		System.out.println(clist);
    		model.addAttribute("clist", clist);
           
            return "jsp/home/security";
            
        }
        return "jsp/userLogin";
    }
    return "jsp/userLogin";
}
}
